function hermite(t, startpos, startvec, endpos, endvec){
    var t2 = t * t;
    var t3 = t2 * t;
    var p0 = 2*t3 - 3*t2 + 1;
    var v0 = t3 - 2*t2 + t;
    var p1 = -2*t3 + 3*t2;
    var v1 = t3 - t2;
    
    var x = startpos[0]*p0 + startvec[0]*v0 + endpos[0]*p1 + endvec[0]*v1;
    var y = startpos[1]*p0 + startvec[1]*v0 + endpos[1]*p1 + endvec[1]*v1;
    var z = startpos[2]*p0 + startvec[2]*v0 + endpos[2]*p1 + endvec[2]*v1;
    return [x, y, z];
}
